package com.lb.map;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
import javafx.scene.chart.BarChart;
import org.springframework.util.CollectionUtils;

import java.util.*;

/**
 * @Author: zhangjun
 * @Date: 2020/6/18 16:21
 * @Description:
 */
public class MapTest {
    public static void main(String[] args) throws JsonProcessingException {
        Set<String> brands = Sets.newHashSet();
        brands.add("白玻");
        brands.add("彩玻");
        brands.add(null);

        Map map = Maps.newHashMap();
        map.put("brands", brands);

        Set<String> brand = (Set<String>) map.get("brands");
        brand.forEach(System.out::println);

        List<String> list = Lists.newArrayList();
        list.add(null);
        list.add("aa");

        ObjectMapper objectMapper = new ObjectMapper();
        System.out.println(objectMapper.writeValueAsString(map));

        List<Map<String, Object>> values = new ArrayList<>();
        Map m = new HashMap();
        m.put("id","");
        m.put("value","10");
        m.put("flag","insert");
        values.add(m);
        System.out.println(objectMapper.writeValueAsString(values));
    }
}
